package com.leve.admin.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Transient;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;
import java.util.Map;

@ApiModel("小鬼")
@Data
@Document
public class Ghost {
    @ApiModelProperty(value = "标识", readOnly = true)
    @Null
    private String id;

    @ApiModelProperty(position = 1, value = "是否注册")
    @JsonIgnore
    private Boolean enabled = false;

    @ApiModelProperty(position = 2, value = "是否激活脸", readOnly = true)
    private Boolean faceEnabled = false;

    @ApiModelProperty(position = 3, value = "是否客服虚拟的")
    @JsonIgnore
    private Boolean virtual = false;

    @ApiModelProperty(position = 4, value = "用户标识", readOnly = true)
    private String user_id;

    @ApiModelProperty(position = 5, value = "云信用户标识", readOnly = true)
    private String im_id;
    @ApiModelProperty(position = 6, value = "经纬度", allowableValues = "range[2,2]", example = "[113.943549,22.548181]")
    @Size(min = 2, max = 2)
    private List<Double> location;

    @ApiModelProperty(position = 7, value = "出生日期", required = true)
    @NotNull
    @Past
    private Date birthday;

    @ApiModelProperty(position = 8, value = "性别:MALE男,FEMALE女", required = true)
    @NotNull
    private Gender gender;

    @ApiModelProperty(position = 9, value = "昵称", required = true, allowableValues = "range[0,20]")
    @NotBlank
    @Size(max = 20)
    private String nickname;
    private User user;
    @ApiModelProperty(position = 10, value = "头像地址", required = true, allowableValues = "range[1,256]")
    @NotBlank
    @Size(min = 1, max = 256)
    private String avatar;

    @ApiModelProperty(position = 11, value = "鬼话", allowableValues = "range[0,90]")
    @Size(max = 90)
    private String whatIsUp;

    @ApiModelProperty(position = 12, value = "行业", allowableValues = "range[0,30]")
    @Size(max = 30)
    private String industry;

    @ApiModelProperty(position = 13, value = "学校", allowableValues = "range[0,30]")
    @Size(max = 30)
    private String school;

    @ApiModelProperty(position = 14, value = "开启谁能看到我", readOnly = true)
    private Boolean openToEnabled = false;


    @ApiModelProperty(position = 17, value = "最新照片地址", readOnly = true)
    private List<String> album;

    @ApiModelProperty(position = 18, value = "最后发表此刻标识")
    @JsonIgnore
    private String lastPostId;

    @ApiModelProperty(position = 19, value = "最后发表此刻时间")
    @JsonIgnore
    private Date lastPostDate;

    @ApiModelProperty(position = 20, value = "最后活动时间")
    @JsonIgnore
    private Date lastActionDate = new Date();

    @ApiModelProperty(position = 21, value = "每日计数器最后更新日期")
    @JsonIgnore
    private Date lastRollDate = new Date();

    @ApiModelProperty(position = 22, value = "每日心动匹配总数")
    @JsonIgnore
    private Integer dailyTotalMatches = 0;

    @ApiModelProperty(position = 23, value = "每日心动喜欢总数")
    @JsonIgnore
    private Integer dailyTotalLoves = 0;

    @ApiModelProperty(position = 24, value = "创建日期时间")
    @CreatedDate
    private Date created_date;

    @ApiModelProperty(position = 25, value = "最后修改日期时间")
    private Date last_modified_date;

    @ApiModelProperty(position = 26, value = "此刻总数", readOnly = true)
    private Integer total_posts = 0;

    @ApiModelProperty(position = 27, value = "关注我的总数", readOnly = true)
    private Integer totalFollowers = 0;

    @ApiModelProperty(position = 28, value = "被我关注的总数", readOnly = true)
    private Integer totalFollowings = 0;

    @ApiModelProperty(position = 29, value = "收到的打招呼总数", readOnly = true)
    private Integer totalGreetings = 0;

    @ApiModelProperty(position = 30, value = "查询者是否屏蔽被查询者", readOnly = true)
    @Transient
    private Boolean blocked;

    @ApiModelProperty(position = 31, value = "是否不让查询者看被查询者的此刻", readOnly = true)
    @Transient
    private Boolean postHidden;

    @ApiModelProperty(position = 32, value = "查询者是否关注过此被查询者", readOnly = true)
    @Transient
    private Boolean followed = false;

    @ApiModelProperty(position = 33, value = "用户头像地址", readOnly = true)
    @Null
    private String userAvatar;

    @ApiModelProperty(position = 34, value = "激活此账户的小鬼标识", allowableValues = "range[0,24]")
    @Size(max = 24)
    @JsonIgnore
    private String createdBy;

    @ApiModelProperty(position = 35, value = "脸创建日期时间")
    @JsonIgnore
    private Date faceEnablingDate;

    @ApiModelProperty(position = 36, value = "最后遇见时间")
    @JsonIgnore
    private Date lastEncounterDate;

    private String phone;
    private int friendsNumber;
    private int upNumber;
    @ApiModelProperty(position = 44, value = "是否相互关注", readOnly = true)
    @Transient
    private Boolean bidirectional;
    private EosAccount eos_account;
    @ApiModelProperty(position = 46, value = "查询者是否和被查询者互为好友", readOnly = true)
    @Transient
    private Boolean coupled;

    @JsonIgnore
    public Point getPoint() {
        return new Point(location.get(0), location.get(1));
    }

    private Map postNumber;
    private double upc = 0.0D;
    private Date loginDate;
}
